/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Entity;

import KoneksiDatabase.Koneksi;
import com.mysql.jdbc.Statement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 *
 * @author User
 */
public class DataGejala {
private String namaGejala;
    private String namaobat;
    private int noid;

    /**
     * @return the namaGejala
     */
    public DataGejala(){

    }

    public String getNamaGejala() {
        return namaGejala;
    }

    /**
     * @param namaGejala the namaGejala to set
     */
    public void setNamaGejala(String namaGejala) {
        this.namaGejala = namaGejala;
    }

    /**
     * @return the namaobat
     */
    public String getNamaobat() {
        return namaobat;
    }

    /**
     * @param namaobat the namaobat to set
     */
    public void setNamaobat(String namaobat) {
        this.namaobat = namaobat;
    }

    /**
     * @return the noid
     */
    public int getNoid() {
        return noid;
    }

    /**
     * @param noid the noid to set
     */
    public void setNoid(int noid) {
        this.noid = noid;
    }
      public ResultSet dataGejalaView() throws SQLException {
        java.sql.Statement st =  Koneksi.getConnection().createStatement();
        ResultSet rs = st.executeQuery("SELECT * FROM datagejala");
//        while(rs.next()){
//            setNoid(rs.getInt("noid"));
//            setNamaGejala(rs.getString("namaGejala"));
//
//        }
//        st.close();
        return rs;
    }
//      public ResultSet tableGejalaView() throws SQLException {
//        java.sql.Statement st =  Koneksi.getConnection().createStatement();
//        ResultSet rs = st.executeQuery("SELECT  FROM datagejala");
////        while(rs.next()){
////            setNoid(rs.getInt("noid"));
////            setNamaGejala(rs.getString("namaGejala"));
////
////        }
////        st.close();
//        return rs;
//    }
       public void insertGejala() throws SQLException {
        PreparedStatement ps = Koneksi.getConnection().prepareStatement("INSERT INTO datagejala(noid,namaGejala) VALUES (?,?)");
        ps.setInt(1, getNoid());
        ps.setString(2, getNamaGejala());
      

        ps.executeUpdate();
    }

}
